<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ page trimDirectiveWhitespaces="true" %>

<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@taglib prefix="spring" uri="http://www.springframework.org/tags" %>

<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
<base href="<%=basePath%>"/>
<title>${applicationScope.KEY_SITE_NAME}</title>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<link rel="stylesheet" type="text/css" href="resources/css/intlogin.css" />
<script src="resources/scripts/jquery-1.9.1.js" type="text/javascript"></script>
<script type="text/javascript" src="resources/scripts/rsa/RSA.js"></script>  
<script type="text/javascript" src="resources/scripts/rsa/BigInt.js"></script>  
<script type="text/javascript" src="resources/scripts/rsa/Barrett.js"></script> 

<script type="text/javascript">
<!--
var keym;
var keye;
$(document).ready(function(){         
    $('#kaptchaImage').click(function () {//生成验证码  
     $(this).hide().attr('src', 'kaptcha/getKaptchaImage.do?' + Math.floor(Math.random()*100) ).fadeIn();
     event.cancelBubble=true;  
    });
    
    $.post("rsa/getkeystr", function(obj,
			status) {
		keym=obj.pkeyMod;
		keye=obj.pkeyExp;
	}); 
});

function encrptPwd() {
    setMaxDigits(129);  
    var key = new RSAKeyPair(keye,'',keym);  
    var pwdRtn = encryptedString(key,$("#password").val());
    $("#password").val("");
    $("#encrypted_pwd").val(pwdRtn);
    $("#formLogin").submit();
    return;
}
-->
</script>


</head>
	<body>
	<a href="admin/index/?locale=ja_JP">日文</a>
	<a href="admin/index/?locale=zh_CN">中文</a>
		<div id="login">
			<!-- login -->
			<div class="title">
				<h5><spring:message code="Label.index.signin" /></h5>
			</div>
			<c:if test="${not empty param.authenticationNok}">
				<div class="messages">
					<div id="message-error" class="message message-error">
					<div class="image">
						<img src="resources/images/icons/error.png" alt="Error" height="32" />
					</div>
					<div class="text">
						<span><spring:message code="msg.login.failed"/></span>
					</div>
					
				</div>
				</div>
			</c:if>
			
			<c:if test="${not empty param.codeerror}">
				<div class="messages">
					<div id="message-error" class="message message-error">
					<div class="image">
						<img src="resources/images/icons/error.png" alt="Error" height="32" />
					</div>
					<div class="text">
						<span><spring:message code="error.login.code.wrong"/></span>
					</div>
					
				</div>
				</div>
			</c:if>
			
			<div class="inner">
			<spring:url value="/j_spring_security_check" var="login" />
				<form id="formLogin" action="admin${login}" method="post">
				<div class="form">
					<!-- fields -->
					<div class="fields">
						<div class="field">
							<div class="label">
								<spring:message code="Label.index.usernmae" />
							</div>
							<div class="input">
								<input type="text" id="username" name="j_username" size="40" value="" class="focus" />
							</div>
						</div>
						<div class="field">
							<div class="label">
								<spring:message code="Label.index.password" />
							</div>
							<div class="input">
								<input type="password" id="password" name="j_password" size="40" value="" class="focus" />
								<input type="hidden" id="encrypted_pwd" name="j_encrypted_pwd" />
							</div>
						</div>
						<div class="field">
							<div class="label">
								<spring:message code="Label.index.checkNumber"/>
							</div>
							<div class="input">
								<input name="j_code" type="text" id="kaptcha" maxlength="4"/>
							</div>							
						</div>
						<div class="field">
							<div class="label">
								<spring:message code="Label.index.changeNumber"/>
							</div>
							<div class="input">
								<img src="kaptcha/getKaptchaImage.do" id="kaptchaImage" style="margin-bottom: -3px" />
							</div>
						</div>

						<div>
							<input name="signIn" type="button" class="loginbtn" id="signIn" value="<spring:message code='Label.index.login'/>" onclick="return encrptPwd()"/>
						</div>
					</div>
				</div>
				</form>
			</div>
			<!-- end login -->
		</div>
	</body>
</html>